#include <iostream>
#include <list>
#include <algorithm>
#include <assert.h>

using namespace std;

#include "ReverseIterator.h"
#include "List.h"

void test1()
{
	my_list::list<int> l1;
	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_back(4);
	l1.push_back(5);
	l1.push_back(6);
	l1.push_back(7);

	my_list::list<int>::iterator it1 = l1.begin();
	while (it1 != l1.end())
	{
		cout << (*it1) << ' ';
		++it1;
	}
	cout << endl;

	cout << l1.size() << endl;

	my_list::list<int> l2(l1);
	my_list::list<int>::iterator it2 = l2.begin();
	while (it2 != l2.end())
	{
		cout << (*it2) << ' ';
		++it2;
	}

	cout << endl;

	my_list::list<int> l3;
	l3.push_back(123);
	l3.push_back(123);
	l3.push_back(123);
	l3.push_back(123);
	l3.push_back(123);
	my_list::list<int>::iterator it3 = l3.begin();
	while (it3 != l3.end())
	{
		cout << (*it3) << ' ';
		++it3;
	}
	cout << endl;

	l3 = l1;
	it3 = l3.begin();
	while (it3 != l3.end())
	{
		cout << (*it3) << ' ';
		++it3;
	}
	cout << endl;
}

void test2()
{
	my_list::list<int> l1;
	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_back(4);
	l1.push_back(5);
	my_list::list<int>::iterator it = l1.begin();
	while (it != l1.end())
	{
		cout << *it << ' ';
		++it;
	}
	cout << endl;

	my_list::list<int>::reverse_iterator rit = l1.rbegin();
	while (rit != l1.rend())
	{
		cout << *rit << ' ';
		++rit;
	}
	cout << endl;
}

//void test3()
//{
//	list<int> l1;
//	l1.push_back(1);
//	l1.push_back(2);
//	l1.push_back(3);
//	l1.push_back(4);
//	l1.push_back(5);
//	list<int>::iterator it = l1.begin();
//	while (it != l1.end())
//	{
//		cout << *it << ' ';
//		++it;
//	}
//	cout << endl;
//
//	list<int>::reverse_iterator rit = l1.rbegin();
//	while (rit != l1.rend())
//	{
//		cout << *rit << ' ';
//		++rit;
//	}
//	cout << endl;
//}

int main()
{
	//test1();
	test2();
	//test3();

	return 0;
}
